package com.xbongbong.paas.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.xbongbong.paas.outerlink.interfaces.PaasOuterLinkConfigService;
import com.xbongbong.paas.pojo.dto.OuterLinkAddOutLinkExtensionDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkAdvancedGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkAdvancedSaveDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkAppearanceGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkAppearanceSaveDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkCloseOutLinkDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkConfigGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkDelOutLinkExtensionDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkDisplayGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkDisplaySaveDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkFilterGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkFilterSaveDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkGetOutLinkExtensionDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkPermissionGetDTO;
import com.xbongbong.paas.pojo.dto.OuterLinkPermissionSaveDTO;
import com.xbongbong.paas.redis.PaasRedisHelper;
import com.xbongbong.paas.service.OuterLinkConfigService;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import com.xbongbong.pro.constant.XbbProConstant;
import com.xbongbong.pro.enums.errorcodes.SystemErrorCodeEnum;
import com.xbongbong.pro.outLink.pojo.OutLinkAdvancedGetVO;
import com.xbongbong.pro.outLink.pojo.OutLinkDisplayGetVO;
import com.xbongbong.pro.outLink.pojo.OutLinkExtensionGetVO;
import com.xbongbong.pro.outLink.pojo.OutLinkFilterGetVO;
import com.xbongbong.pro.outLink.pojo.OutLinkSettingGetVO;
import com.xbongbong.pro.outLink.pojo.OuterLinkAppearanceGetVO;
import com.xbongbong.pro.outLink.pojo.OuterLinkShareVO;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Objects;

/**
 * @author long.rao
 * @version v1.0
 * @date 2020/8/10 9:10
 * @since v1.0
 */
@RestController
@RequestMapping(XbbProConstant.API_ROOT_PREFIX + "/outerLink")
public class OuterLinkConfigController {

    @Resource
    private PaasRedisHelper paasRedisHelper;
    @Resource
    private PaasOuterLinkConfigService outerLinkConfigService;

    /**
     * 获取外观设置
     * @param outerLinkAppearanceGetDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/appearance/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getAppearance(@RequestBody @Valid OuterLinkAppearanceGetDTO outerLinkAppearanceGetDTO, BindingResult br) throws Exception {
        XbbResponse<OuterLinkAppearanceGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                OuterLinkAppearanceGetVO appearance = outerLinkConfigService.getAppearance(outerLinkAppearanceGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 保存外观设置
     * @param outerLinkAppearanceSaveDTO
     * @param br
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/appearance/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String saveAppearance(@RequestBody @Valid OuterLinkAppearanceSaveDTO outerLinkAppearanceSaveDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                BaseVO appearance = outerLinkConfigService.saveAppearance(outerLinkAppearanceSaveDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 获取获取外链权限设置获取（外链查询，外链填写 外链分享）
     * @param outerLinkPermissionGetDTO
     * @param br
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/permission/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getPermission(@RequestBody @Valid OuterLinkPermissionGetDTO outerLinkPermissionGetDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                BaseVO appearance = outerLinkConfigService.getPermission(outerLinkPermissionGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 获取获取外链权限设置获取（外链查询，外链填写 外链分享）
     * @param outerLinkPermissionSaveDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/permission/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String permissionSave(@RequestBody @Valid OuterLinkPermissionSaveDTO outerLinkPermissionSaveDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkPermissionSaveDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkPermissionSaveDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.permissionSave(outerLinkPermissionSaveDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * 显示
     * @param outerLinkDisplaySaveDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/display/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String displaySave(@RequestBody @Valid OuterLinkDisplaySaveDTO outerLinkDisplaySaveDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkDisplaySaveDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkDisplaySaveDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.displaySave(outerLinkDisplaySaveDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * 显示获取
     * @param outerLinkDisplayGetDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/display/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String displayGet(@RequestBody @Valid OuterLinkDisplayGetDTO outerLinkDisplayGetDTO, BindingResult br) throws Exception {
        XbbResponse<OutLinkDisplayGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                OutLinkDisplayGetVO appearance = outerLinkConfigService.displayGet(outerLinkDisplayGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * 获取获取外链筛选设置
     * @param outerLinkFilterGetDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/filter/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String permissionSave(@RequestBody @Valid OuterLinkFilterGetDTO outerLinkFilterGetDTO, BindingResult br) throws Exception {
        XbbResponse<OutLinkFilterGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                OutLinkFilterGetVO appearance = outerLinkConfigService.filterGet(outerLinkFilterGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    /**
     * 获取获取外链筛选设置
     * @param outerLinkConfigGetDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/form/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getOutLinkConfig(@RequestBody @Valid OuterLinkConfigGetDTO outerLinkConfigGetDTO, BindingResult br) throws Exception {
        XbbResponse<OutLinkSettingGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkConfigGetDTO.getIgnoreConCheck()) && !Objects.equals(outerLinkConfigGetDTO.getIsGet(),1)) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkConfigGetDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                OutLinkSettingGetVO appearance = outerLinkConfigService.getOutLinkConfig(outerLinkConfigGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }
    /**
     * 保存外链筛选设置
     * @param outerLinkFilterSaveDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/field/filter/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String permissionSave(@RequestBody @Valid OuterLinkFilterSaveDTO outerLinkFilterSaveDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkFilterSaveDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkFilterSaveDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.filterSave(outerLinkFilterSaveDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }


    /**
     * 高级设置获取
     * @param outerLinkAdvancedGetDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/senior/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getAdvanced(@RequestBody @Valid OuterLinkAdvancedGetDTO outerLinkAdvancedGetDTO, BindingResult br) throws Exception {
        XbbResponse<OutLinkAdvancedGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                OutLinkAdvancedGetVO appearance = outerLinkConfigService.getAdvanced(outerLinkAdvancedGetDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 高级设置保存
     * @param outerLinkAdvancedSaveDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/senior/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String saveAdvanced(@RequestBody @Valid OuterLinkAdvancedSaveDTO outerLinkAdvancedSaveDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkAdvancedSaveDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkAdvancedSaveDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.advancedSave(outerLinkAdvancedSaveDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 关闭外链
     * @param outerLinkCloseOutLinkDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/form/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String closeOutLink(@RequestBody @Valid OuterLinkCloseOutLinkDTO outerLinkCloseOutLinkDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkCloseOutLinkDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkCloseOutLinkDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.closeOutLink(outerLinkCloseOutLinkDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }
    /**
     * 添加外联拓展
     * @param
     * @param br
     * @param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/extened/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String addOutLinkExtension(@RequestBody @Valid OuterLinkAddOutLinkExtensionDTO outerLinkAddOutLinkExtensionDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkAddOutLinkExtensionDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkAddOutLinkExtensionDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.addOutLinkExtension(outerLinkAddOutLinkExtensionDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 获取外联拓展
     * @param
     * @param br
     * @param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/extened/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getOutLinkExtension(@RequestBody @Valid OuterLinkGetOutLinkExtensionDTO outerLinkGetOutLinkExtensionDTO, BindingResult br) throws Exception {
        XbbResponse<OutLinkExtensionGetVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            try {
                OutLinkExtensionGetVO appearance = outerLinkConfigService.getOutLinkExtension(outerLinkGetOutLinkExtensionDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 删除外联拓展
     * @param
     * @param br
     * @param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/extened/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String delOutLinkExtension(@RequestBody @Valid OuterLinkDelOutLinkExtensionDTO outerLinkDelOutLinkExtensionDTO, BindingResult br) throws Exception {
        XbbResponse<BaseVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkDelOutLinkExtensionDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkDelOutLinkExtensionDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                BaseVO appearance = outerLinkConfigService.delOutLinkExtension(outerLinkDelOutLinkExtensionDTO);
                response = new XbbResponse<>(appearance);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }

    /**
     * 复制获取外链分享链接
     * @param outerLinkDTO
     * @param br
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/share/copy", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String shareCopy(@RequestBody @Valid OuterLinkDTO outerLinkDTO, BindingResult br) throws Exception {
        XbbResponse<OuterLinkShareVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            // ----------------------------------repeat post----------------------------------------------
            // 判断是否跳过重复提交校验
            if (!Boolean.TRUE.equals(outerLinkDTO.getIgnoreConCheck())) {
                //重复提交校验
                if (!paasRedisHelper.checkConcurrentLock(outerLinkDTO)) {
                    response = new XbbResponse<>(new XbbException(SystemErrorCodeEnum.API_ERROR_100003));
                    return JSON.toJSONString(response);
                }
            }
            try {
                OuterLinkShareVO outerLinkShareVO = outerLinkConfigService.shareCopy(outerLinkDTO);
                response = new XbbResponse<>(outerLinkShareVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response, SerializerFeature.DisableCircularReferenceDetect);
    }
}
